import request from '@/utils/request'

export default {
  getDonateList(searchModel) {
    return request({
      url: '/releaseDonate/list',
      method: 'get',
      params: {
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize,
        releaseDonateName: searchModel.releaseDonateName,
        releaseDonateType: searchModel.releaseDonateType
      }
    })
  },
  addDonate(donate) {
    return request({
      url: '/releaseDonate',
      method: 'post',
      data: donate
    })
  },
  updateDonate(donate) {
    return request({
      url: '/releaseDonate',
      method: 'put',
      data: donate
    })
  },
  deleteDonateById(id) {
    return request({
      url: `/releaseDonate/${id}`,
      method: 'delete'
    });
  },
  saveDonate(donate) {
    if (donate.id == null && donate.id == undefined) {
      return this.addDonate(donate)
    }
    return this.updateDonate(donate)
  },
  getDonateById(id) {
    return request({
      // url: '/releaseActivity/' + id,
      url: `/releaseDonate/${id}`,
      method: 'get'
    })
  }
}
